<?php
namespace App\Http\Controllers\Client\Talent;

use App\Http\Controllers\ClientController;
use App\Models\Common\RedisTool;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;

class TalentNoticeController extends ClientController
{

    // 用户切换是否接受发单微信消息推送
    public function index()
    {

        try{
            $all = $this->all;
            $notice = $all['notice'];
            $notice = $notice? 1: 0;
            // 修改状态
            DB::table('lottery_users')->where('we_id','=',$this->we_id)->update(['notice' => $notice]);
            RedisTool::refreshUser($this->we_id);
            return $this->setReturnJson(0,'success');
        } catch (\Exception $e){
            Log::error(TalentNoticeController::class,['msg' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
            return $this->setReturnJson(0,'修改失败');
        }
    }

}
